@extends('backend.layouts.default')

@section('content')
  <div class="box box-primary">
    <div class="box-header with-border">
      <h3 class="box-title">标签列表</h3>

      <div class="box-tools">
        <form action="{{ route('tags.index') }}">
          <div class="input-group input-group-sm" style="width: 300px;">
            <input type="text" name="query" class="form-control pull-right" value="{{ $query }}" placeholder="搜索">

            <div class="input-group-btn">
              <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
              <a class="btn btn-default margin-left" href="{{ route('tags.create') }}">添加</a>
            </div>
          </div>
        </form>
      </div>
    </div>
    <div class="box-body table-responsive">
      <table class="table table-hover table-bordered">
        <tr>
          <th>ID</th>
          <th>名称</th>
          <th>是否在前端显示</th>
          <th>操作</th>
        </tr>
        @forelse ($tags as $tag)
          <tr>
            <td>{{ $tag->id }}</td>
            <td>{{ $tag->name }}</td>
            <td>{{ whether($tag->is_display) }}</td>
            <td>
              <a class="btn btn-default btn-xs" href="{{ route('tags.edit', $tag->id) }}">编辑</a>
              <a-form class-name="btn btn-default btn-xs" action="{{ route('tags.destroy', $tag->id) }}" method="delete">删除</a-form>
            </td>
          </tr>
        @empty
          <tr>
            <td colspan="4">暂无数据</td>
          </tr>
        @endforelse
      </table>
    </div>
    <div class="box-footer clearfix text-right">
      {!! $tags->render() !!}
    </div>
  </div>
@endsection
